package com.example.springboottest.student.apollo;

import com.ctrip.framework.apollo.model.ConfigChangeEvent;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfigChangeListener;
import org.springframework.stereotype.Service;

@Service
public class ApolloListenerDemo {
    @ApolloConfigChangeListener
    public void apolloOnChange(ConfigChangeEvent changeEvent) {
        changeEvent.changedKeys().forEach(
                key -> System.out.println(key + "\t发生了变化,值\t" + changeEvent.getChange(key).getOldValue()
                        + " ---> " + changeEvent.getChange(key).getNewValue())
        );
    }
}
